<template>
  <custom-container>
    <custom-container-header no-spacing>
      <el-form :model="filters" ref="form" :disabled="loading"
               inline size="medium"
               @submit.native.prevent="gridSearch"
      >
        <el-form-item label="会员账户名">
          <el-input v-model="filters.username" auto-complete="off" />
        </el-form-item>

        <el-form-item label="交易类型">
          <el-select v-model="filters.tradeType">
            <el-option v-for="item in tradeTypeList" :label="item.title" :key="item.value" :value="item.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" native-type="submit">查询</el-button>
        </el-form-item>
      </el-form>
    </custom-container-header>
    <custom-container-body>
      <el-table :data="tableData.list" :loading="loading" element-loading-text="加载中..." border border-radius
      >
        <el-table-column
          align="center"
          prop="tradeNo"
          width="220"
          label="交易单号">
        </el-table-column>
        <el-table-column
          align="center"
          label="交易时间">
          <template slot-scope="{row}">
            {{row.createTime | toTime}}
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          prop="tradeType"
          label="交易类型">
        </el-table-column>
        <el-table-column
          align="center"
          prop="userName"
          label="会员名">
        </el-table-column>
        <el-table-column
          align="center"
          label="金额">
          <template slot-scope="{row}">
            {{row.amount | currency}}
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          label="手续费">
          <template slot-scope="{row}">
            {{row.commfee | currency}}
          </template>
        </el-table-column>
        <template slot="empty">
          <div class="el-table__empty">
            <svg-icon class="el-table__empty-icon" icon-class="grid-empty-2"></svg-icon>
            <div class="el-table-text">暂无数据</div>
          </div>
        </template>
      </el-table>
      <div class="el-pagination-container">
        <el-pagination
          bordered
          @size-change="gridSizeChange" @current-change="gridCurrentChange"
          :current-page="filters.page" :page-size="filters.size"
          :total="tableData.total">
        </el-pagination>
      </div>
    </custom-container-body>
  </custom-container>
</template>

<script>
  import {memberFeeDetailApi as getApi} from '@/services/api/report';

  import {grid} from '@/build';

  export default {
    name: "member-fee-detail",
    mixins: [grid],

    props: ['info'],

    data() {
      return {
        filters: {
          settleDate: this.info.settleDate,
          username: undefined,
          tradeType: 0,
          size: 10,
        },
        tradeTypeList: [
          // 0全部,1存款,2提款
          {
            title: '全部',
            value: 0,
          },
          {
            title: '存款',
            value: 1,
          },
          {
            title: '取款',
            value: 2,
          },
        ],
        tableData: {
          total: 0,
          list: []
        }
      };
    },

    mounted() {
      this.bindGet(getApi, 'tableData', {
        action: 'getGrid',
        sendingData: 'filters',
      });

      this.getAll();
    }
  };
</script>

<style scoped>

</style>